package cn.itcast.hotel.controller;

import cn.itcast.hotel.service.IHotelService;
import cn.itcast.hotel.service.impl.HotelService;
import cn.itcast.hotel.vo.PageResult;
import cn.itcast.hotel.vo.Params;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/hotel")
public class HotelController {

    @Resource
    private IHotelService hotelService;



    @PostMapping("/list")
    public PageResult search(@RequestBody Params params) {
        return hotelService.search(params);
    }



    @PostMapping("/filters")
    public Map<String, List<String>> filters(@RequestBody Params params) {
        return hotelService.filters(params);
    }

    @GetMapping("/suggestion")
    public List<String> suggestion(@RequestParam("key") String key) {
        return hotelService.suggestion(key);
    }
}
